#define _CRT_SECURE_NO_WARNINGS 1

#include "Data.h"

Data::Data(int year, int month, int day)
	:_year(year),_month(month),_day(day)
{
	
}

bool Data::operator<(const Data& data)
{
	if (_year > data._year)
	{
		return false;
	}
	if (_year == data._year && _month > data._month)
	{
		return false;
	}
	if (_year == data._year && _month == data._month && _day >= data._day)
	{
		return false;
	}
	
	return true;
}

bool Data::operator==(const Data& data)
{
	if (_year == data._year && _month == data._month && _day == data._day)
		return true;
	else
		return false;
}

Data& Data::operator=(const Data& data)
{
	if(this!=&data)
	{
		_year = data._year;
		_month = data._month;
		_day = data._day;
	}
	return *this;
}

Data Data::operator+(int x)
{
	Data d = *this;
	d._day += x;
	return d;
}
Data& Data::operator+=(int day)
{
	*this = *this + day;
	return *this;
}

Data& Data:: operator++()
{
	*this += 1;
	return *this;
}

Data Data:: operator++(int)
{
	Data d = *this;
	*this += 1;
	return d;
}

void Data::Print()const
{
	cout << "Print()const" << endl;
	cout << _year << " " << _month << " " << _day << endl;
}

void Data::Print()
{
	cout << "Print()" << endl;
	cout << _year << " " << _month << " " << _day << endl;
}


Data* Data::operator&()
{
	return this;
}

const Data* Data::operator&() const
{
	return this;
}


ostream& operator<<(ostream& o, Data& data)
{
	cout << data._year << " " << data._month << " " << data._day << endl;
	return o;
}
istream& operator>>(istream& i, Data& data)
{
	cin >> data._year >> data._month >> data._day;
	return i;
}
